import os
from celery import Celery
from celery.schedules import crontab

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Web_backend.settings')

app = Celery('data')
app.config_from_object('django.conf:settings', namespace='CELERY')

app.conf.beat_schedule = {
    'deduct-membertime-hourly': {
        'task': 'data.tasks.deduct_membertime_hourly',
        'schedule': crontab(minute=0, hour='*'),  # 每小时执行一次
    },
}

app.autodiscover_tasks()